CREATE PROCEDURE CourseFacultyCourseSearch
@CourseId VARCHAR(40) = '%'
AS
BEGIN

DECLARE @SCourseId VARCHAR(50) = '%'+@CourseId+'%';

	SELECT 
		CF.CFacId AS CourseFacultyId,
		C.AutoId AS CourseAutoId,
		C.CourseId,
		C.Name AS Course,
		F.FacultyAutoId AS FacultyAutoId,
		F.Name AS Faculty,
		S.AutoId AS SemAutoId,
		S.Name AS Semester
	FROM 
		CourseFaculty CF
		INNER JOIN Faculty F ON CF.FacultyAutoId = F.FacultyAutoId
		INNER JOIN Course C ON CF.CourseAutoId = C.AutoId
		INNER JOIN Semester S ON CF.SemAutoId = S.AutoId 
	WHERE
		C.CourseId like @SCourseId;
END
